package br.com.fidalgotecnologia.layar.json;

import org.json.JSONException;
import org.json.JSONObject;

import br.com.fidalgotecnologia.core.constantes.Links;
import br.com.fidalgotecnologia.layar.entity.Icon;

public class IconJson {
	private Icon icon;
    private JSONObject json;
    
    public IconJson(Icon icon){
    	this.icon = icon;
    	json = new JSONObject();
    	try {
			json.put( "url",Links.LINK_ICON_FILE+this.icon.getId());
			json.put( "type",this.icon.getType());	
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
    }
    
   public JSONObject getJson() {
	return json;
}
    
	@Override
	public String toString() {
		String retorno = null;
		
		try {
			
			retorno = json.toString();
		} catch (Exception  e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return retorno;
	}

}